<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Teachers in School</title>
</head>
<body>
<table width="100%">
	<tr>
		<td>
		<h4>Teachers in School</h4>
		</td>
	</tr>
</table>

<%-- Table to show teacher's list in school --%>

<table border="1" width="100%" rules="rows"
	style="background-color: #99CCFF;" cellpadding="4px">
	<tr style="background-color: #3D3D3D; color: white; font-weight: bold">
		<td width="50">Sr.No.</td>
		<td width="100">Name</td>
		<td width="70">Designation</td>
		<td>Qualifications</td>
		<td>SpecialCourses</td>
		<td width="90">Date Of Joining</td>
		<td width="30"></td>
	</tr>
	<c:forEach var="teacher" items="${teachers}" varStatus="a">
		<tr>
			<td width="50">${a.index + 1}</td>
			<%-- URL for teachers detailed profile --%>
			<s:url value="/school/teachers/{teacherId}" var="detailedProfile">
				<s:param name="teacherId" value="${teacher.teacherId}"></s:param>
			</s:url>
			<td width="100"><a href="${detailedProfile}">${teacher.firstName} ${teacher.middleName}
			${teacher.lastName}</a></td>
			<td width="70">${teacher.designation}</td>
			<td>${teacher.qualifications}</td>
			<td>${teacher.specialCourses}</td>
			<td width="90"><fmt:formatDate value="${teacher.dateOfJoining}"
				pattern="MMM d, yyyy" /></td>

			<%-- prepare url for edit link --%>
			<s:url value="/school/editTeacher/{teacherId}" var="editUrl">
				<s:param name="teacherId" value="${teacher.teacherId}" />
			</s:url>
			<%--	delete url		--%>
			<s:url value="/school/deleteTeacher/${teacher.teacherId}" var="deleteUrl"/>
			<td><a href="${editUrl}">Edit</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a
				href="${deleteUrl}">Delete</a>
			</td>
			
		</tr>
	</c:forEach>
</table>

</body>
</html>